package arithmetic;
//题目：输入某年某月某日，判断这一天是这一年的第几天？
import java.util.Scanner;

public class Arithmetic14 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int year = sc.nextInt();
        int month = sc.nextInt();
        int day = sc.nextInt();
        int count = 0;
        for (int i = 1; i <=month ; i++) {
            switch (i){
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                  count +=31;
                  break;
                case 2:
                    if (fun(year)){
                        count +=29;
                    }else {
                        count +=28;
                    }
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    count +=30;
                    break;
            }

        }
        System.out.println(count);

    }
    public static boolean fun(int a){
        if (a%4==0&&a%100!=0||a%400==0){
            return true;
        }else {
            return false;
        }
    }
}
